//
// Created by jsjxsy on 2022/8/12.
// 练习题 11.9 C prime plus
// 反转字符串
//
#include <stdio.h>
#include <string.h>
void swap(char arr[], int i, int j) {
  char temp = arr[i];
  arr[i] = arr[j];
  arr[j] = temp;
}
void reverse(char arr[], const int size) {
  if (size < 2) {
    return;
  }
  for (int i = 0; i < size / 2; i++) {
    swap(arr, i, size - 1 - i);
  }
}
void test(char arr[]){
  printf("arr = %s\n", arr);
  printf("arr size : %lu\n", strlen(arr));
  reverse(arr, strlen(arr));
  printf("arr = %s\n", arr);
}
int main(void) {
  char str[4][10] = {"abc","abcd","12345","!@#"};
  for(int i=0;i<4;i++){
    test(str[i]);
  }
  return 0;
}